<?php
	
	$name  ="";
	if(isset($_GET['name']))
	{
		$name = $_GET['name'];
	}	
	
	$showCategory = -1 ;
	if(isset($_GET['showCategory']))
	{
		$showCategory = $_GET['showCategory'];
	}
	
	
	$notification ="";
	if(isset($_GET['notification']))
	{
		$notification =constant($_GET['notification']);
	}
	
	//tao list category cho nguoi dung` lua chon
	$listCategory='<select name="lCaterogies" id="input3">';
	if($showCategory == -1)
	{
		$listCategory.='<option value="-1" selected="selected">-- Please choose Catergory --</option>';
	}
	else
	{
		$listCategory.='<option value="-1" >-- Please choose Catergory --</option>';
	}
	
	
	$category = new CCategory;
	$arrCategory = $category -> CCategoryList();
	

	if(is_array($arrCategory))
	{
		foreach ($arrCategory as $key => $value)
		{
			//$listCategory .='<option value="'.$value['id'].'" title="'.$value['description'].'"> '.$value['name'].' </option>';
			if($showCategory ==$value['id'] )
			{
				$listCategory .='<option selected="selected" value="'.$value['id'].'" > '.$value['name'].' </option>';

			}
			else
			{
				$listCategory .='<option value="'.$value['id'].'" > '.$value['name'].' </option>';
			}
		}
	}
	
	
	
	
	$listCategory .='</select>';
	//ket thuc tao list category 
	
	$mainContent = '<form action="processType.php" method="post" name="form1">
					
					<script type="text/javascript">
						bkLib.onDomLoaded(function() {
						new nicEditor({maxHeight : 200}).panelInstance("area");
						});
					</script>
	
					<div id="content2">
						<span style="font-size:10px;color:#FF0000;font-weight:bold;font-family:Arial, Helvetica, sans-serif">'.$notification.'</span>
						<table border="0" width="90%" style="position:relative" align = "center" >
						<tr>
							<td colspan="2" align="left" valign="middle" height="50px"> 
							 <img src="images/profile.png" style="float:left" border="0"/>
							<span class="mystyle1"> Add more Types </span>		 </td>
						</tr>
						<tr>
							<td><span class="mystyle2">Catergory <span>
							</td>
							<td>'.$listCategory.'
							</td>
						</tr>
						
						<tr>
							<td><span class="mystyle2">Name <span>
							</td>
							<td>
								<input id="input3" type="text" name="tf_name" value="'.$name.'" >
							</td>
						</tr>
						
						<tr>
							<td valign="top"><span class="mystyle2">Description <span>
							</td>
							<td>
								
								<textarea cols="55" name="tf_description" id="area" style="height: 100px;">	Some Initial Content was in this textarea</textarea>
							</td>
						</tr>
						<tr align="center">
							<td colspan="2" height="50px">
								<input id="input2"  type="submit" name="btn_ok" value="  OK  ">
								<input id="input2" name="btn_cancel" type="submit" value="  Cancel  " >
							</td>
						</tr>
 
						</table>
					</div>
					<input type="hidden" name = "hTypeAction" value ="add">
					</form>';

?>